# Maintainer: Filipe Laíns (FFY00) <lains@archlinux.org>

pkgname=cairosvg
_pkgname=CairoSVG
pkgver=2.1.3
pkgrel=5
pkgdesc='SVG converter based on Cairo. It can export SVG files to PDF, PostScript and PNG files'
arch=('any')
url='http://cairosvg.org'
license=('LGPL3')
depends=('python' 'python-setuptools' 'python-cairocffi' 'python-pillow' 'python-cssselect2' 'python-defusedxml' 'python-tinycss2')
checkdepends=('python-pytest-runner' 'python-pytest-cov' 'python-pytest-flake8' 'python-pytest-isort')
provides=("python-cairosvg=$pkgver")
replaces=('python-cairosvg')
source=("$pkgname-$pkgver.tar.gz::https://github.com/Kozea/CairoSVG/archive/$pkgver.tar.gz")
sha512sums=('2fe079be6e471ab28bbcd16d8dba00729ffc920163aa6a0fabf1223db21685a25fc03118e41f059e6164a3c1afd5375e05022954846fd75bc6b76ad122e90ef5')

prepare() {
  cd $_pkgname-$pkgver

  cp -r cairosvg test/cairosvg_reference/
}

build() {
  cd $_pkgname-$pkgver

  python setup.py build
}

check() {
  cd $_pkgname-$pkgver

  python setup.py pytest
}

package() {
  cd $_pkgname-$pkgver

  python setup.py install --root="$pkgdir" --optimize=1 --skip-build
}

